/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.yutel.main;

import com.yutel.biz.Login;
import com.yutel.gui.IndexForm;
import com.yutel.gui.LoginForm;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

/**
 * @author yuanyajun
 */
public class WSClientMIDlet extends MIDlet {

    static WSClientMIDlet instance;
    private Display display = null;

    public WSClientMIDlet() {
        instance = this;
    }

    public void startApp() {
        display=Display.getDisplay(this);
        Login login=new Login();
        boolean re=login.autoLogin();
        if (re) {
            IndexForm indexFrom = new IndexForm();
            setDisplay(indexFrom);
        } else {
            LoginForm loginFrom = new LoginForm();
            setDisplay(loginFrom);
        }
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public static void quitApp() {
        instance.destroyApp(true);
        instance.notifyDestroyed();
        instance = null;
    }

    public static void setDisplay(Displayable dis) {
        instance.display.setCurrent(dis);
    }
}
